package com.chen.blue.controller.admin.business;


import com.chen.blue.annotation.RepeatSubmit;
import com.chen.blue.annotation.permission.DataPermission;
import com.chen.blue.domain.delete.business.ContestApplyActiveDelete;
import com.chen.blue.domain.delete.system.DeptDelete;
import com.chen.blue.domain.dto.business.ContestApplyActiveDto;
import com.chen.blue.domain.dto.business.update.ContestApplyActiveDtoEdit;
import com.chen.blue.domain.dto.system.DeptDto;
import com.chen.blue.domain.dto.system.update.DeptDtoEdit;
import com.chen.blue.domain.query.business.ContestApplyActiveQuery;
import com.chen.blue.domain.query.system.DeptQuery;
import com.chen.blue.exception.e.DtoNullException;
import com.chen.blue.exception.e.NoDeleteException;
import com.chen.blue.result.R;
import com.chen.blue.service.business.IContestApplyActiveService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;

/**
 * <p>
 * 竞赛申请活动表 前端控制器
 * </p>
 *
 * @author CLT
 * @since 2024-05-23
 */
@ApiSort(997)
@Api(tags = "申报管理-赛事申请模块")
@Validated
@RestController
@PreAuthorize("hasRole('ROLE_teacher')")
@RequestMapping("/contest/active")
public class ContestApplyActiveController {

    @Resource
    private IContestApplyActiveService iContestApplyActiveService;

    @ApiOperation(value = "竞赛申请添加(赛事及其赛项不存在则1->2->3；否则2-3；不支持保存)", notes = "竞赛申请添加(赛事及其赛项不存在则1->2->3；否则2-3；不支持保存)")
    @ApiOperationSupport(ignoreParameters = {"fileBaseOne", "creator", "updater", "id"})
    @RepeatSubmit
    @PostMapping("/add")
    public R add(@Valid ContestApplyActiveDto contestApplyActiveDto) throws DtoNullException, IOException {

        return iContestApplyActiveService.addContestApplyActive(contestApplyActiveDto) ? R.success() : R.faild();

    }

//    @ApiOperation(value = "竞赛申请修改", notes = "竞赛申请修改")
//    @ApiOperationSupport(ignoreParameters = {"fileBaseOne", "creator", "updater"})
//    @RepeatSubmit
//    @PutMapping("/update")
//    public R update(@Valid ContestApplyActiveDto contestApplyActiveDto) throws DtoNullException, IOException {
//
//        return iContestApplyActiveService.updateContestApplyActive(contestApplyActiveDto) ? R.success() : R.faild();
//
//    }

}

